package com.csdj.rest.controller;

import com.csdj.common.WebResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局异常处理
 */
@ControllerAdvice
public class GlobalExceptionController {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public WebResult handlerException(Exception e){
        e.printStackTrace();
        return WebResult.fail(400);
    }
}
